<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorate="layout">
<head th:include="include/common::common"></head>
<!--<%@ include file="include/title.jsp" %>-->
<link th:href="@{/res/plugins/datepicker/datepicker3.css}" rel="stylesheet"/>
<link th:href="@{/res/plugins/validator/bootstrapValidator.min.css}" rel="stylesheet"/>
<link th:href="@{/res/lobibox/lobibox.css}" rel="stylesheet"/>
<link th:href="@{/css/home/home.css}" rel="stylesheet"/>
<style>
    .cell {
        height: 500px;
        vertical-align: middle;
        display: inline-block;
        line-height: 500px;
    }
</style>
</head>

<!-- skin-blue 为 AdminLTE 的主题颜色 可选颜色主题：/res/dist/css/skins-->
<body class="hold-transition skin-blue sidebar-mini">
<!--<body class="hold-transition skin-green-light sidebar-mini">-->
<div class="wrapper">
    <!--header-->
    <div th:include="include/header"></div>
    <!--menu-->
    <aside th:include="include/menu"/>
    <!-- Left side column. contains the logo and sidebar -->
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!--<section class="content-header">
            &lt;!&ndash; 路径导航 &ndash;&gt;
            <a href="${path}/home"><i class="fa fa-home"></i> 主页</a> >
        </section>-->
        <!-- Main content -->
        <section class="content">
            <div class="row-fluid"></div>
            <div class="row">
                <div class="col-xs-12">
                    <ul class="timeline">
                    </ul>
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
    </div>
    <!--footer-->
    <div th:include="include/footer"></div>
    <div class="control-sidebar-bg"></div>
</div>

<script>
    $(function () {
        var timeline = $('.timeline');
        $.ajax({
            type: 'GET',
            async: false,
            url: '/statistics/timelist',
            success: function (data) {
                var map = data.data;
                var count = 0;

                var years = [];
                $.each(map, function (key, list) {
                    years.push(key);
                });
                years.sort(function (a, b) {
                    return b-a;
                });

                $.each(years, function (index, key) {
                    var li_year = '<li class="time-label">' +
                        '<span class="bg-green">' + key + '</span>' +
                        '</li>';
                    timeline.append(li_year);

                    var list = map[key];
                    $.each(list, function (index, diary) {
                        var wd = millisecondToDate(diary.writeDate, format4);
                        var time = millisecondToDate(diary.writeDate, format5)
                        var kw;
                        if (diary.isLock == 1) kw = '已锁定'; else kw = base64Decoder(diary.keyword);
                        var li_diary = '<li>' +
                            '<i class="fa fa-comments bg-yellow"></i>' +
                            '<div class="timeline-item">' +
                            '<span class="time"><i class="fa fa-clock-o"></i> ' + time + '</span>' +
                            '<h3 class="timeline-header"><a href="#">' + wd + '</a></h3>' +
                            '<div class="timeline-body">' + kw + '</div>' +
                            '<div class="timeline-footer">' +
                            // '<a class="btn btn-primary btn-xs">...</a>' +
                            '</div>' +
                            '</div>' +
                            '</li>';
                        timeline.append(li_diary);
                    });


                });
            }
        });
    });
</script>
<!-- Sidebar toggle button 菜单收缩功能 -->
<script th:src="@{/res/dist/js/app.min.js}" type="text/javascript"></script>
<script th:src="@{/res/laydate/laydate.js}" type="text/javascript"></script>
<script th:src="@{/res/plugins/datepicker/bootstrap-datepicker.js}" type="text/javascript"></script>
<script th:src="@{/res/plugins/datepicker/bootstrap-datetimepicker.zh-CN.js}" type="text/javascript"></script>
<script th:src="@{/res/plugins/validator/bootstrapValidator.min.js}" type="text/javascript"></script>
<script th:src="@{/js/site.js}" type="text/javascript"></script>
<script th:src="@{/js/base64.js}" type="text/javascript"></script>
<script th:src="@{/res/kindeditor-4.1.4/kindeditor-all-min.js}" type="text/javascript"></script>
<script th:src="@{/res/kindeditor-4.1.4/lang/zh_CN.js}" type="text/javascript"></script>
<script th:src="@{/res/echarts.min.js}" type="text/javascript"></script>
<script th:src="@{/js/home/home.js}" type="text/javascript"></script>
</body>
</html>
